<?php

class LoginDAO extends  BaseDAO {

    /*
     * @method Tikrina ar vartotojas existuoja
     * @return true arba false
     */
    public function isUserExist($username = '',$password = ''){
        $sql ='SELECT * FROM `account` WHERE `user_name`=\''.$username.'\' AND `pass`=\''.$password.'\' ;';
        $result = mysql_query($sql);
        if($result == false){
            return false;
        }else{
            $user = mysql_fetch_object($result,'account');
            if($user->user_name == $username){
                return true;
            }
        }
        return false;
    }

    /*
     * @method Tikrina ar vartotojas existuoja
     * @return true arba false
     */
    public function isUser($username = ''){
        $sql ='SELECT * FROM `account` WHERE  `password`=\''.$username.'\' ;';
        $result = mysql_query($sql);
        if($result == false){
            return false;
        }else{
            $user = mysql_fetch_object($result,'account');
            if($user->username == $username){
                return true;
            }
        }
        return false;
    }

    function LoginDAO(){
        $this->initDB();
    }
}

?>